<html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" layout:decorator="base/layout.html">


    <!-- start: Content -->
    <div layout:fragment="content" class="main ">

        <div class="row">
            <div class="col-lg-12">
                <ol class="breadcrumb">
                    <li><i class="fa fa-home"></i><a th:href="@{../infoManage/indexTotal}">首页</a></li>

                    <li><i class="fa fa-indent"></i>信息发布</li>
                </ol>
            </div>
        </div>

        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <h2><i class="fa fa-indent red"></i><strong>信息发布</strong></h2>
                    </div>
                    <div class="panel-body">
                        <form id="modularForm"  method="post" enctype="multipart/form-data" class="form-horizontal ">



                            <div class="form-group">
                                <label class="col-md-3 control-label" for="text-input">标题</label>
                                <div class="col-md-6">
                                    <input type="text"  id="title" name="title" class="form-control" placeholder="标题" required>
                                    <span class="help-block">请输入标题(必填)</span>
                                </div>
                            </div>

                            <div class="form-group">
                                <label class="col-md-3 control-label" for="text-input">内容</label>
                                <div class="col-md-9">
                                   <textarea class="layui-textarea" id="introduction" style="display: none" required>


					                </textarea>
                                </div>
                            </div>





                            <br>

                    </div>
                    <div class="panel-footer">
                        <button id="submitBtn" type="submit" class="btn btn-sm btn-success"><i class="fa fa-dot-circle-o"></i> 提交</button>
                        <button type="reset" class="btn btn-sm btn-danger"><i class="fa fa-ban"></i>重置</button>
                    </div>
                    </form>
                </div>
            </div>


        </div><!--/.row-->


        <script>

            var layedit, index;

           





            $(document).ready(function() {


                var pro = window.location.protocol;
                var host = window.location.host;
                var domain = pro + "//" + host;

                layui.use(['layedit','upload'], function(){
                    layedit = layui.layedit;
                    layedit.set({
                        uploadImage: {
                            url: 'uploadLayuiFile?domain='+domain,
                            type: 'post'
                        }
                    });
                    index = layedit.build('introduction');
                });

            })


            $("#modularForm").validate({

                submitHandler: function(form)
                {
                    /*layedit.sync(index);*/
                    var formdata ={};
                    var content=layedit.getContent(index);

                    if (content.length==0||$.trim(content)==""){
                        layer.msg("请输入内容")
                    }else{
                        formdata.introduction = layedit.getContent(index);
                        $("#modularForm").ajaxSubmit(
                            {
                                url: 'infoManageAdd',
                                type: 'post',
                                data :formdata,
                                success: function (data) {

                                    layer.msg("添加成功");
                                    setTimeout(function () {
                                        window.location = ("queryInfoManage")
                                    }, 1500);
                                }
                                //clearForm: false,//禁止清楚表单
                                //resetForm: false //禁止重置表单
                            });
                    }
                }
            })











        </script>

    </div>




    <!-- end: Content -->

